const API = require('../../pages/api/index')
const { typeJson } = require('../../utils/typejson')
let prolist = wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist'))


Page({

  /**
   * 页面的初始数据
   */
  data: {
    pulldown:"",
    pullup:2,
    addButton:true,
    prolist:wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist')),
    listConfig: [
      {
        label: "发现时间",
        prop: "discoverDate",
      
      },
      {
        label: "隐患部位",
        prop: "part",
      },
      ],

      slide: {
        slideButton: {
          text: '编辑',
          extClass: 'test',
            src: '/page/weui/cell/icon_star.svg', // icon的路径
        },
        formConfig: [
          {
            label: "计划名称",
            prop: "recId",
            type: 'dropDownSearch',
            hidden: 'look',
            required:true,
            net: {
              url: '/app/checkRec/getList',
              method: 'post',
              key: 'planName',
              data:{
                mineId: true,
              },
              value: 'id'
            }
          }, 
  
          {
            label: "隐患描述",
            prop: "content",
            type:"textarea",
          },
          {
            label: "来源",
            prop: "source", 
            jsonType:typeJson.source,
            type: "dropDown",
            required:true,
          },
          {
            label: "隐患部位",
            prop: "part",
            required:true,
          },
          {
            label: "隐患级别",
            prop: "level",
            type: "dropDown",
            jsonType: typeJson.level,
            required:true,
          },
          // {
          //   label: "发现方式",
          //   prop: "discoverWay",
          //   type: "dropDown",
          //   jsonType:typeJson.discoverWay
          // },
          {
            label: "发现人",
            prop: "discoverMan",
            hidden: 'edit',
          },
          {
            label: "核查人",
            prop: "verifyMan",
            hidden: 'edit',
          },
          {
            label: "核查人",
            prop: "verifyManId",
            type: 'dddropDownSearch',
            hidden: 'look',
            required:true,
            net: {
              url: '/system/user/list',
              method: 'get',
              key: 'nickName',
              data:{
                mineId: true,
              },
              value: 'memberId'
            }
          },
          {
            label: "发现时间",
            prop: "discoverDate",
            required:true,
            type:"date"
          },
          {
            label: "整改类型",
            prop: "rectifyType",
            type: "dropDown",
            jsonType: typeJson.rectifyType,
            hidden: 'edit',
          },
          {
            label: "整改方式",
            prop: "rectifyWay",
            type: "dropDown",
            jsonType: typeJson.rectifyWay,
            hidden: 'edit',
          },
          {
            label: "整改期限",
            prop: "rectifyExpires",
            hidden: 'edit',
          },
          {
            label: "复查时间",
            prop: "reviewDate",
            type:"date",
            hidden: 'edit',
          },
          {
            label: "复查人",
            prop: "reviewMan",
            hidden: 'edit',
          },
          {
            label: "复查状态",
            prop: "reviewStatus",
            type: "dropDown",
            jsonType: typeJson.reviewStatus,   
            hidden: 'edit', 
          },
         
          ],
      },


      formConfig: [
        {
          label: "计划名称",
          prop: "recId",
          type: 'dropDownSearch',
          hidden: 'look',
          required:true,
          net: {
            url: '/app/checkRec/getList',
            method: 'post',
            key: 'planName',
            data:{
              mineId: true,
            },
            value: 'id'
          }
        },

        {
          label: "隐患描述",
          prop: "content",
          type:"textarea",
        },
        {
          label: "来源",
          prop: "source", 
          jsonType:typeJson.source,
          type: "dropDown",
          required:true,
        },
        {
          label: "隐患部位",
          prop: "part",
          required:true,
        },
        {
          label: "隐患级别",
          prop: "level",
          type: "dropDown",
          jsonType: typeJson.level,
          required:true,
        },
        // {
        //   label: "发现方式",
        //   prop: "discoverWay",
        //   type: "dropDown",
        //   jsonType:typeJson.discoverWay
        // },
        {
          label: "发现人",
          prop: "discoverMan",
          hidden: 'edit',
        },
        {
          label: "核查人",
          prop: "verifyMan",
          hidden: 'edit',
        },
        {
          label: "核查人",
          prop: "verifyManId",
          type: 'dddropDownSearch',
          hidden: 'look',
          required:true,
          net: {
            url: '/system/user/list',
            method: 'get',
            key: 'nickName',
            data:{
              mineId: true,
            },
            value: 'memberId'
          }
        },
        {
          label: "发现时间",
          prop: "discoverDate",
          required:true,
          type:"date"
        },
        {
          label: "整改类型",
          prop: "rectifyType",
          type: "dropDown",
          jsonType: typeJson.rectifyType,
          hidden: 'edit',
        },
        {
          label: "整改方式",
          prop: "rectifyWay",
          type: "dropDown",
          jsonType: typeJson.rectifyWay,
          hidden: 'edit',
        },
        {
          label: "整改期限",
          prop: "rectifyExpires",
          hidden: 'edit',
        },
        {
          label: "复查时间",
          prop: "reviewDate",
          type:"date",
          hidden: 'edit',
        },
        {
          label: "复查人",
          prop: "reviewMan",
          hidden: 'edit',
        },
        {
          label: "复查状态",
          prop: "reviewStatus",
          type: "dropDown",
          jsonType: typeJson.reviewStatus,   
          hidden: 'edit', 
        },
        {
          label: '上传照片',
          prop: 'riskPhoto',
          type: 'image',
        },
        {
          label: '',
          prop: 'discoverManSign',
          type: 'canvas',
          hidden: 'edit', 
        },
       
        
       


     
       
      
        ],
    
        
        net: {
       
            select: {
              url: `/app/riskExcludeNew/getList`,
              method: 'post',
              data: {
                mineId: true,
                
              }
            },
            delete: {
              url: '/app/riskExcludeNew/delete',
              method: 'get',
              data: {
                
              }
            },
            insert: {
              url: '/app/riskExcludeNew/insert',
              method: 'post',
              data: {
                mineId:true,
                discoverManId:"userid",

               
              }
            },
            update: {
              url: '/app/riskExcludeNew/update',
              method: 'post',
              data: {
  
              }
            }
  
          
        },
        showCom:true
      },

     
  

  /**
   * 生命周期函数--监听页面加载
   */


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
   
    this.setData({
      showCom: false
    });
    this.setData({
      showCom: true
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

   /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh()
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.setData({
      pullup: this.data.pullup + 1
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})